package com.cn.qtms.entity;//类注释设置模板

import com.cn.qtms.base.entity.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * @Name:TmSecKill
 * @Description:
 * @Author: zhangyang
 * @Date: 2019-12-26 11:41
 **/
@Entity
@Table(name = "tm_sec_kill")
@org.hibernate.annotations.Table(appliesTo = "tm_sec_kill",comment="秒杀库存表")
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class TmSecKill extends BaseEntity {

    @Column(name="secgoods_id",columnDefinition = "bigint(20) comment '秒杀商品id'" )
    @JsonSerialize(using = ToStringSerializer.class)
    private  Long secGoodsId;

    @Column(name="act_id",columnDefinition = "bigint(20) comment '秒杀活动id'" )
    @JsonSerialize(using = ToStringSerializer.class)
    private Long actId;

    @Column(name="goods_id",columnDefinition = "bigint(20) comment '商品id'" )
    @JsonSerialize(using = ToStringSerializer.class)
    private Long goodsId;

    @Column(name = "kill_date",columnDefinition="date COMMENT '秒杀日期'")
    @Temporal(TemporalType.TIMESTAMP)
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date killDate;

    @Column(name="act_type",columnDefinition = "int(10) comment '场次'" )
    private Integer actType;

    /**
     * 单次结束剩余库存
     */
    @Column(name="end_count",columnDefinition = "int(10) COMMENT '单次活动结束剩余库存'" )
    private  Integer endCount;

    /**
     * 秒杀活动总库存
     */
    @Column(name="total_count",columnDefinition = "int(10) COMMENT '单次秒杀活动库存'" )
    private Integer totalCount;

    /**
     * 状态 是否归还到商品库存
     */
    @Column(name = "status", columnDefinition = "varchar(10) COMMENT '状态 0初始化 1已归还'")
    private  String status;
}
